package com.lwq.nacos.grayscale.gray;

import com.alibaba.ttl.TransmittableThreadLocal;

public class NacosMetaDataContextHolder {

    private static final TransmittableThreadLocal<NacosMetaDataContext> context = new TransmittableThreadLocal<NacosMetaDataContext>(){
        @Override
        protected NacosMetaDataContext initialValue() {
            return new NacosMetaDataContext();
        }
    };

    public static TransmittableThreadLocal<NacosMetaDataContext> getThreadLocalContext() {
        return context;
    }


    public static NacosMetaDataContext getContext() {
        return context.get();
    }

    public static void setContext(NacosMetaDataContext context) {
        NacosMetaDataContextHolder.context.set(context);
    }

    public static void remove() {
        context.remove();
    }


}